from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
driver = webdriver.Chrome()
sleep(2)
driver.get("http://localhost/ranzhi/www/crm/customer-browse.html")
sleep(2)
driver.maximize_window()
sleep(2)
driver.find_element(By.ID,"account").send_keys("123456")
sleep(2)
driver.find_element(By.NAME,"password").send_keys("123456")
sleep(2)
driver.find_element(By.ID,"submit").click()
sleep(5)
driver.find_element(By.XPATH,'/html/body/div[1]/div[1]/div/ul[1]/li[8]/button').click()
sleep(2)
#框架的切入
driver.switch_to.frame("iframe-superadmin")
sleep(2)
driver.find_element(By.XPATH,'/html/body/div[2]/div/div/div[1]/div/a/h3').click()
sleep(2)
#返回根框架
# driver.switch_to.default_content()#根框架
# # driver.switch_to.parent_frame()#返回上一级框架
# driver.find_element(By.LINK_TEXT,"签退").click()
# sleep(2)
#下拉框操作
from selenium.webdriver.support.select import Select
#定位下拉框
ele=driver.find_element(By.ID,"role")
#创建 下拉框对象
sle_obj=Select(ele)
#调用方法
# sle_obj.select_by_index(2)
# sle_obj.select_by_visible_text("市场主管")
sle_obj.select_by_value("hr")
sleep(2)
driver.quit()